from django.contrib import admin

from .models import *

# 新农贸后台管理

# 每页显示数据量
page_size = 1000

class Category1Admin(admin.ModelAdmin):
    # 显示列的顺序
    list_display = ('id', 'category_name')

    # 每页显示数据量
    list_per_page = page_size

class Category2Admin(admin.ModelAdmin):
    # 显示列的顺序
    list_display = ('id', 'fid', 'category_name')

    # 每页显示数据量
    list_per_page = page_size

class DetailAdmin(admin.ModelAdmin):
    # 显示列的顺序
    list_display = ('id', 'cid1', 'cid2', 'market_name', 'product_name', 'min_price', 'avg_price', 'max_price',
                    'standards', 'place', 'unit', 'pub_date')

    # 每页显示数据量
    list_per_page = page_size

# 注册一级分类
admin.site.register(Category1, Category1Admin)

# 注册二级分类
admin.site.register(Category2, Category2Admin)

# 注册行情数据
admin.site.register(Detail, DetailAdmin)